#ifndef HISTORYPAGE_H
#define HISTORYPAGE_H

#include <QWidget>
#include <QVector>
#include "sql/sqlite/historydao.h"
#include "search/searchengine.h"
#include <QFutureWatcher>
#include "main_window.h"

namespace Ui {
class HistoryPage;
}

class HistoryPage : public QWidget
{
    Q_OBJECT

public:
    explicit HistoryPage(QWidget *parent = nullptr);
    ~HistoryPage();
    void setSeacher(SearchEngine<Page::PAGE_HISTORY>* searcher);
    void scrollToItem(qint64 fileId);

    void setMainWindow(MainWindow* mainWindow);
public slots:
    void pullData();
protected:
    void paintEvent(QPaintEvent *event) override;
private slots:
    void on_BackUpBtn_clicked();

    void on_SelectAll_clicked();

    void on_DeleteAllSelectedBtn_clicked();

private:
    Ui::HistoryPage *ui;
    HistoryDao m_dao;
    int m_i = 0;
    SearchEngine<Page::PAGE_HISTORY>* m_searcherPtr = nullptr;
    int m_currentPage = 1;
    static constexpr int m_pageSize = 50;
    MainWindow* m_mainWindow = nullptr;
};

#endif // HISTORYPAGE_H
